package com.frame.service.impl;

import com.frame.domain.Logistics;
import com.frame.mapper.LogisticsMapper;
import com.frame.service.LogisticsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogisticsServiceImpl implements LogisticsService {

    @Autowired
    private LogisticsMapper logisticsMapper;

    @Override
    public PageInfo<Logistics> getLogisticsInfo(Logistics logistics, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Logistics> list= logisticsMapper.getLogisticsInfo(logistics);
        PageInfo<Logistics> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public void SaveUpdateLogistics(Logistics logistics) {
        if(logistics.getTransportId()!=null){//修改
            logisticsMapper.updateLogistics(logistics);
        }else {//新增
            logisticsMapper.saveLogistics(logistics);
        }
    }

    @Override
    public void deleteLogistics(Integer id) {
        logisticsMapper.deleteLogistics(id);
    }

    @Override
    public List<Logistics> getRawMaterialInfo() {
        return logisticsMapper.getRawMaterialInfo();
    }

    @Override
    public List<Logistics> getList() {
        return logisticsMapper.getList();
    }

    @Override
    public void updateStatus(Integer id,String status) {
        logisticsMapper.updateStatus(id,status);
    }

    @Override
    public boolean updatejq(Integer id) {
        return logisticsMapper.updatejq(id);
    }

    @Override
    public boolean updateqs(Integer id) {
        return logisticsMapper.updateqs(id);
    }
    @Override
    public boolean updateqianshou(Integer id) {
        return logisticsMapper.updateqianshou(id);
    }


}
